﻿
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}

<script>
    $(function () {
        gridList();
        $('.menuItem').on('click', window.parent.$.Newtouchtab.addTab);
    })
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.newtouchLocalDataGrid({
            height: $(window).height() - 185,
            datatype: "local",
            unwritten: false,
            colModel: [
                { label: "主键", name: "sfxmbh", hidden: true, key: true },
                //{ label: "代码", name: "sfxm", width: 80, align: 'left' },
                { label: '收费项目', name: 'sfxmmc', width: 100, align: 'left' },
                { label: '拼音', name: 'py', width: 80, align: 'left' },
                { label: '单位', name: 'dw', width: 50, align: 'left' },
                { label: '单价', name: 'dj', width: 80, align: 'left' },
                { label: '大类', name: 'dlmc', width: 100, align: 'left' },
                { label: '分类', name: 'flmc', width: 100, align: 'left' },
                { label: '自负比例', name: 'zfbl', width: 50, align: 'left' },
                { label: '医保代码', name: 'ybdm', width: 100, align: 'left' },
                { label: '物价代码', name: 'wjdm', width: 100, align: 'left' },
                 {
                     label: '范围', name: 'mzzybz', width: 80, align: 'left',
                     formatter: function (cellvalue) {
                         if (cellvalue == "0") {
                             return "通用";
                         } else if (cellvalue == "1") {
                             return "门诊";
                         } else if (cellvalue == "2") {
                             return "住院";
                         } else {
                             return "";
                         }
                     }
                 }, {
                     label: '实施', name: 'ssbz', width: 50, align: 'left',
                     formatter: function (cellvalue) {
                         if (cellvalue == 0) {
                             return "是"
                         } else {
                             return "否"
                         }
                     }
                 },
    {
        label: '特殊', name: 'tsbz', width: 50, align: 'left',
        formatter: function (cellvalue) {
            if (cellvalue == 0) {
                return "是"
            } else {
                return "否"
            }
        }
    },
    {
        label: '警示', name: 'jsbz', width: 50, align: 'left',
        formatter: function (cellvalue) {
            if (cellvalue == 0) {
                return "是"
            } else {
                return "否"
            }
        }
    },
    { label: '收费项', name: 'sfbz', width: 50, align: 'left' },
    {
        label: '有效', name: 'zt', width: 50, align: 'left',
        formatter: function (cellvalue) {
            if (cellvalue == 0) {
                return "无效"
            } else {
                return "有效"
            }
        }
    }],
            pager: "#gridPager",
            sortname: 'desc',
            rowNum: '10',
            viewrecords: true
        });

        var mydata = [
            { id: "1", sfxm: "1", sfxmmc: "轮椅", py: "LunYi", dw: "辆", dj: "￥11700", dlmc: "非治疗项目", flmc: "器材", zfbl: "0", ybdm: "", wjdm: "10000001", mzzybz: "门诊", ssbz: "1", sfbz: 1 },
            { id: "2", sfxm: "2", sfxmmc: "口罩", py: "KouZhao", dw: "袋", dj: "￥15", dlmc: "非治疗项目", flmc: "器材", zfbl: "0", ybdm: "", wjdm: "10000002", mzzybz: "通用", ssbz: "1", sfbz: 1 },
            { id: "3", sfxm: "3", sfxmmc: "按摩椅", py: "AnMoYi", dw: "辆", dj: "￥5400", dlmc: "非治疗项目", flmc: "器材", zfbl: "0", ybdm: "", wjdm: "10000003", mzzybz: "住院", ssbz: "1", sfbz: 1 }
        ];
        for (var i = 0; i <= mydata.length; i++) {
            $gridList.jqGrid('addRowData', i + 1, mydata[i]);
        }
    }
    function btn_add() {
        $.modalOpen({
            id: "Form",
            title: "收费项目维护",
            url: "/ItemBaseInfo/Add",
            width: "800px",
            height: "520px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
    function btn_edit() {
        var keyValue = $("#gridList").jqGridRowValue().sfxmbh;
        $.modalOpen({
            id: "Form",
            title: "修改信息",
            url: "",//"/SystemManage/SysChargeItem/Form?keyValue=" + keyValue,
            width: "700px",
            height: "520px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
    function btn_delete() {
        $.deleteForm({
            url: "",//"/SystemManage/SysChargeItem/DeleteForm",
            param: { keyValue: $("#gridList").jqGridRowValue().sfxmbh },
            success: function () {
                $("#gridList").trigger("reloadGrid");
            }
        })
    }
    function btn_details() {
        var keyValue = $("#gridList").jqGridRowValue().sfxmbh;
        $.modalOpen({
            id: "Details",
            title: "查看机构",
            url: "",//"/SystemManage/SysChargeItem/Form?keyValue=" + keyValue,
            width: "700px",
            height: "560px",
            btn: null,
        });
    }
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "",//"/SystemManage/SysChargeItem/SubmitForm?keyValue=" + keyValue,
            param: $("#form1").formSerialize(),
            success: function () {
                $("#gridList").resetSelection();
                $("#gridList").trigger("reloadGrid");
                $.loading(false);
            }
        })
    }
</script>
<form id="form1">
    <div class="panel panel-default" style="margin-top:5px;">
        <div class="panel-heading">
            筛选条件
        </div>
        <div style="padding: 2px;padding-right:20px;">
            <table class="form">
                <tr>
                    <td class="formTitle">开始时间</td>
                    <td class="formValue">
                        <input id="Kssj" type="text" class="form-control input-wdatepicker" value="@DateTime.Now.ToString("yyyy-MM-01")" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" />
                    </td>
                    <td class="formTitle">结束时间</td>
                    <td class="formValue">
                        <input id="Jssj" type="text" class="form-control input-wdatepicker" value="@DateTime.Now.ToString("yyyy-MM-01")" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" />
                    </td>
                    <td class="formTitle">关键字</td>
                    <td class="formValue">
                        <input type="text" id="txtINPUTCODE" class="form-control" placeholder="名称" />
                    </td>
                    <td colspan="2">
                        <div style="margin-left:40px">
                            <input type="button" id="btn_search" class="btn btn-primary btn-md" value="查询" style="width:55px" />
                            <a class="menuItem btn btn-primary" onclick="btn_add()">新增项目</a>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</form>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>

